<!DOCTYPE html>
<html>
<head>
<title>forEach渲染示例</title>
</head>
<body>
<ul id="list"></ul>

<script>
    // 数据
    const books = ['《JavaScript入门》', '《HTML教程》', '《CSS指南》'];
    const list = document.getElementById('list');

    // 用forEach遍历并渲染到页面
    books.forEach(book => {
    const li = document.createElement('li');
    li.textContent = book;
    list.appendChild(li);
});
</script>
</body>
</html>